package com.sgj.springcloud.config;

import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;

/**
 * @author 沈国纪
 * @date 2021/5/7 21:45
 */
@Configuration
public class ApplicationContextConfig {

	// 使用 @LoadBalanced 注解赋予 RestTemplate 负载均衡的能力
	@Bean
	// @LoadBalanced
	public RestTemplate getRestTemplate() {
		return new RestTemplate();
	}
}
